package hsl.haxe.bond;
import hsl.haxe.argument.ListenerArgument;
import hsl.haxe.Subject;

class TriadicBond<Datatype, FirstArgumentType, SecondArgumentType, ThirdArgumentType> implements Bond<Datatype> {
	private var firstArgument:ListenerArgument<FirstArgumentType, Datatype>;
	private var listener:FirstArgumentType -> SecondArgumentType -> ThirdArgumentType -> Dynamic;
	private var secondArgument:ListenerArgument<SecondArgumentType, Datatype>;
	private var thirdArgument:ListenerArgument<ThirdArgumentType, Datatype>;
	public function new(listener:FirstArgumentType -> SecondArgumentType -> ThirdArgumentType -> Dynamic, firstArgument:ListenerArgument<FirstArgumentType, Datatype>, secondArgument:ListenerArgument<SecondArgumentType, Datatype>, thirdArgument:ListenerArgument<ThirdArgumentType, Datatype>):Void {
		this.listener = listener;
		this.firstArgument = firstArgument;
		this.secondArgument = secondArgument;
		this.thirdArgument = thirdArgument;
	}
	public function callListener(data:Datatype, currentTarget:Subject):Void {
		listener(firstArgument.getValue(data, currentTarget), secondArgument.getValue(data, currentTarget), thirdArgument.getValue(data, currentTarget));
	}
}
